package com.studerb.tests.integration;

import javax.swing.JTabbedPane;

import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.support.AbstractApplicationContext;
import com.studerb.view.tasks.TasksPane;

import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

/**
 * Applications Swing main Frame from which the GUI is derived Wired in Spring
 * as mainFrame
 */

public class MainTestPanel extends JTabbedPane implements ApplicationContextAware {
	private static final Logger logger = Logger.getLogger(MainTestPanel.class);
	private AbstractApplicationContext springAppContext;
	@Autowired protected TasksPane tasksPane;
	
	public MainTestPanel(){
		super();
	}

	public void init() {
		logger.debug("Initializing...");
		initLayout();
		//initStatusBar();
		//initTaskBar();
		addTab("Tasks", tasksPane);
	}
	

	private void initLayout() {
	}
	
	@Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		logger.debug("Setting Spring AppContext");
		this.springAppContext = (AbstractApplicationContext)applicationContext;
	}
	
	private SingleFrameApplication getSwingApp(){
		return Application.getInstance(GnusbinTestApp.class);
	}
}
